package iut.acy.cut4u.ihm;

import javax.swing.*;

import java.awt.*;
import java.awt.event.*;

public class Planning extends JFrame implements ActionListener,  KeyListener {

	
	protected JButton butAjoutClient;
	protected JButton butAjoutRV ;
	protected JButton butNavigGauche;
	protected JButton butNavigDroite;
	protected JLabel labImage;
	protected Container contenu ;
	protected JPanel panelButtons;
	protected JPanel panelPlanning;
	
	public Planning ()
	{
		super("Planning");
		this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        this.setSize(760,440);
        this.setResizable(false);
        this.creePlanning();

	}
	
	public void creePlanning()
    {   
             this.panelButtons = new JPanel();
		     this.panelPlanning = new JPanel();
		     this.labImage = new JLabel(new ImageIcon( ClassLoader.getSystemResource("fond_planning.jpg")));
		     
		     this.butAjoutClient= new JButton("Ajout Client");          
		     this.butAjoutRV= new JButton(" Ajout RVD ");          
		     this.butNavigGauche= new JButton(" < ");          
		     this.butNavigDroite= new JButton(" > ");          
	         
		     Container contenu = this.getContentPane();
             contenu.setLayout(null);
             
    	     contenu.add(panelButtons);       
     	     contenu.add(panelPlanning);
     	       
		     panelPlanning.setBounds(10,6,580,386);
             panelButtons.setBounds(600,10,160,440);
             
             panelButtons.add(butNavigGauche);
             panelButtons.add(butNavigDroite);
             panelButtons.add(butAjoutClient);
     	     panelButtons.add(butAjoutRV);
             panelPlanning.add(labImage);
     	            	     
             this.butAjoutClient.addActionListener(this);
	         this.butAjoutRV.addActionListener(this);
	  }
            	
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == butAjoutClient)
        {   
			FicheClientAjout f = new FicheClientAjout(this,true);
			f.setVisible(true);
				
        }
	
		if (e.getSource() == butAjoutRV)
        { FicheRVAjout f = new FicheRVAjout(this,true);
		f.setVisible(true);
		}
	
		if (e.getSource() == labImage)
        { FicheRVAjout f = new FicheRVAjout(this,true);
		f.setVisible(true);
		}
	}
	public void keyPressed(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}
	public void keyReleased(KeyEvent e) {
		}
		
	public void keyTyped(KeyEvent e) {
		// TODO Auto-generated method stub
		
	}
	public static void main ( String [ ] args )
    {    Planning P =  new Planning(); 
    		P.setVisible(true);
            }



}
